<?php
header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
echo '<response>';
require_once("includes/include.php");
class addBlogKindClass extends daobase {
	function goAddBlogKind($userId,$kind){
		$sql ="select content from blogkind where userID ='$userId' and content ='$kind'";
		$handle = $this->fetchit($sql);
		if ($handle){
			echo "<mes>该类别已经存在</mes>";
		}
		else {
			$sql ="insert into blogkind(userID,content) values('$userId','$kind');";
			$query = $this->queryit($sql);
			$sql ="select id from blogkind where userId='$userId' and content ='$kind'";
			$result = $this->fetchit($sql);
			$result=$result[0][0];
			if ($query){
				echo "<mes>success</mes>";
				echo "<kind>$result</kind>";
			}else echo "<mes>failed</mes>";
		}
		
	}
}
$blogKind = trim($_POST["blogKind"]);
if($blogKind!=""){
	@session_start();
	$userId = $_SESSION["userId"];
	$dao = new addBlogKindClass();
	$dao ->goAddBlogKind($userId,$blogKind);
}
else {
	echo "<mes>kongblogkind</mes>";
}
echo '</response>';
?>